package com.cloudkinto.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cloudkinto.dto.platform.PlatOrderUpdateTimeDto;
import com.cloudkinto.dto.platform.order.PlatOrderPageRes;
import com.cloudkinto.dto.platform.order.PlatOrderPageStaDto;
import com.cloudkinto.dto.platform.rakuten.OrderRakutenStatusDto;
import com.cloudkinto.entity.PlatformOrderDo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 平台订单 Mapper 接口
 * </p>
 * @author hua
 * @since 2024-12-27
 */
public interface PlatformOrderDao extends BaseMapper<PlatformOrderDo> {

    List<String> getDoingRakutenNos(Long storeId);

    int updateSend(List<Object> orderIds, int status, Long userId);
    int updateTrackNo(List<Object> orderIds);
    int updateTrackNoAndChannelId(List<Object> orderIds);

    int insertPlatformOrder(List<PlatformOrderDo> list);

    /**
     * 根据订单号获取 或者 获取近14天内没有子表信息的数据
     */
    List<PlatOrderUpdateTimeDto> getPlatOrder(List<String> platformOrderNos, Long storeId, String platformCode);

    /**
     * 根据订单号 获取本地订单信息
     */
    List<OrderRakutenStatusDto> getRakutenOrder(List<String> platformOrderNos, Long storeId);


    IPage<PlatOrderPageRes> getList(@Param("page") IPage<PlatOrderPageRes> page, @Param("map")Map<String, Object> map);

    List<PlatOrderPageRes> getList(@Param("map")Map<String, Object> map);

    List<PlatOrderPageStaDto> statusStatistics(@Param("map")Map<String, Object> map);

    String selectReceiver(String receiver);

    PlatformOrderDo selectByPlatformOrderNo(String platformOrderNo);

}
